{% extends "base.html" %}

{% block title %}Rubros{% endblock %}
{% block head %}Listado de rubros{% endblock %}

{% block content %}
    {% if perms.gestion.add_rubros %}
    <form method="POST" action=".">{% csrf_token %}
        <table class="formTableABM" align="center">
            {% for field in form %}
                <tr>
                    <td class="formfieldleft"><br />{{ field.label_tag }}<br />{{ field.errors }}<br /></td>
                    <td class="formfieldmiddle">{{ field }}<br />{{ field.help_text }}</td>
                    <td class="formfieldright"><input type="submit" value="Agregar" /></td>
                </tr>
            {% endfor %}
        </table>
    </form>
    {% else %}
        <p>Usted no tiene permiso para agregar rubros</p>
    {% endif %}
    <br />
    <table class="tablesorter" align="center" id="sorter_clientes" border="0" cellpadding="0" cellspacing="1">
        <thead>
            <tr>
                <th>Rubro</th>
                {% if perms.gestion.change_rubros %}
                <th colspan="2"></th>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for obj in todo %}
                <tr>
                    <td>{{ obj.rubro|default_if_none:"" }}</td>
                    {% if perms.gestion.change_rubros %}
                    <td class="right"><a href="/rubros/editar/{{ obj.id }}/">Editar</a></td>
                    <td class="right"><a href="/rubros/check/{{ obj.id }}/">Eliminar</a></td>
                    {% endif %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <br /><br /><br /><br /><br /><br />
{% endblock %}
 
